/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entityprojet;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author T.Ron
 */
@Entity
@Table(name = "EXERCICECOMPTA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Exercicecompta.findAll", query = "SELECT e FROM Exercicecompta e"),
    @NamedQuery(name = "Exercicecompta.findByNumexo", query = "SELECT e FROM Exercicecompta e WHERE e.numexo = :numexo"),
    @NamedQuery(name = "Exercicecompta.findByDebutexo", query = "SELECT e FROM Exercicecompta e WHERE e.debutexo = :debutexo"),
    @NamedQuery(name = "Exercicecompta.findByFinexo", query = "SELECT e FROM Exercicecompta e WHERE e.finexo = :finexo")})
public class Exercicecompta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "NUMEXO")
    private Integer numexo;
    @Column(name = "DEBUTEXO")
    @Temporal(TemporalType.DATE)
    private Date debutexo;
    @Column(name = "FINEXO")
    @Temporal(TemporalType.DATE)
    private Date finexo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "exercicecompta")
    private Collection<Periode> periodeCollection;

    public Exercicecompta() {
    }

    public Exercicecompta(Integer numexo) {
        this.numexo = numexo;
    }

    public Integer getNumexo() {
        return numexo;
    }

    public void setNumexo(Integer numexo) {
        this.numexo = numexo;
    }

    public Date getDebutexo() {
        return debutexo;
    }

    public void setDebutexo(Date debutexo) {
        this.debutexo = debutexo;
    }

    public Date getFinexo() {
        return finexo;
    }

    public void setFinexo(Date finexo) {
        this.finexo = finexo;
    }

    @XmlTransient
    public Collection<Periode> getPeriodeCollection() {
        return periodeCollection;
    }

    public void setPeriodeCollection(Collection<Periode> periodeCollection) {
        this.periodeCollection = periodeCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numexo != null ? numexo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Exercicecompta)) {
            return false;
        }
        Exercicecompta other = (Exercicecompta) object;
        if ((this.numexo == null && other.numexo != null) || (this.numexo != null && !this.numexo.equals(other.numexo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityprojet.Exercicecompta[ numexo=" + numexo + " ]";
    }
    
}
